using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AYE.BaseFramework.Manager.Extensions;
using AYE.Interface;
using AYE.Service;
using DryIoc;
using Microsoft.Extensions.Logging;
using NLog;
using Prism.Dialogs;

namespace AYE.ModuleRegistration;

public class RegistrationModule : IModule
{

    private readonly ILogger<RegistrationModule> _logger;
    public RegistrationModule(ILogger<RegistrationModule> logger)
    {
        _logger = logger;
    }

    /// <summary>
    /// 此模块预加载之后，当主页面成功得到之后 才会加载子模块内部的注册
    /// </summary>
    /// <param name="containerRegistry"></param>
    public void RegisterTypes(IContainerRegistry containerRegistry)
    {
        //业务的服务注册//
        containerRegistry.RegisterSingleton<IGlobalCacheManager, GlobalCacheManager>();
        containerRegistry.RegisterAllJob();

    }

    /// <summary>
    /// 模块化注册结束，最后的在这里进行一系列的数据初始化操作
    /// 全局缓存数据的初始化 也在这里
    /// 
    /// </summary>
    /// <param name="containerProvider"></param>
    public void OnInitialized(IContainerProvider containerProvider)
    {
        //缓存数据初始化
        containerProvider.Resolve<IGlobalCacheManager>().LoadAllAsync();
        //containerProvider.Resolve<IJobManager>().InitializeSchedulerAsyncTest();

    }

}
